package cn.sm1234.controller;

import cn.sm1234.domain.User;
import org.springframework.scheduling.support.SimpleTriggerContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class UserController {

    // 展示列表
    @RequestMapping("/list")
    public String list(Model model){
        // 模拟加载用户数据
        List<User> list = new ArrayList<User>();
        list.add(new User(1,3,"tom"));
        list.add(new User(2,30,"Jerry"));

        // 把数据存入模型model, 用作传递
        model.addAttribute("list", list);

        // 跳转到freemarker页面，"list.ftl" ,文件必需放在resources/templates
        return "list";
    }

}
